package com.java.day06;

public class Student {



    private String name;

    int age;


    //封装
    public String getName(){
        return name;
    }

    public void setName(String name){
        if(name.length()<3 || name.length()>10){
            this.name = "张三";
            System.out.println("名字非法,使用默认名字'张三'");
        }else{
            this.name = name;
        }
    }

}
